#!/bin/sh


if [ $# -gt 0 -a -d ../branches/$1 ] 
then
	if [ -f ../branches/compendium.po ]
	then
		echo "Updating translations for $1..."
		cd ../branches/$1
		for po in *.po ; do
			msgmerge --compendium=../compendium.po --no-wrap -o $po $po $po ;
		done
		echo "All $1 files have been updated from the compendium." ;
	else
		echo "There is no compendium. Create one first with './create-compendium.sh'"
	fi
else
	echo "The branch '$1' does not exist. A valid branch must be specified."
	echo "Usage: ./update-from-compendium.sh [BRANCH]."
fi